<template>
  <div id="recruitTable">
    <!-- <h1>方案文件</h1> -->
    <!-- <div v-if="canEdit">
      <el-upload
        class="upload-demo"
        action="https://jsonplaceholder.typicode.com/posts/"
        :on-preview="handlePreview"
        :on-remove="handleRemove"
        :before-remove="beforeRemove"
        multiple
        :limit="3"
        :on-exceed="handleExceed"
        :file-list="fileList">
        <el-button size="small" type="primary">点击上传</el-button>
      </el-upload>
      <el-button icon="el-icon-document-copy" type="primary" style="float:right;margin-left:10px">初始化</el-button>
      <el-button icon="el-icon-plus" type="success" style="float:right" @click="addFormVisible1=true">新增</el-button>
    </div>
    <div v-else>
      <div><a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> 单位1事业单位岗位设置方案表.pdf</a></div>
      <div><a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> 单位2事业单位岗位设置方案表.pdf</a></div>
    </div>
    <el-button v-if="!canEdit" icon="el-icon-download" type="primary" style="float:right">导出</el-button>
    <h1 style="text-align:center">事业单位岗位设置方案表</h1> -->
    <el-dialog :title="dialogTitle" :visible.sync="editFormVisible" width="98%" top="20px">

      <el-form v-if="status===1" :model="editForm" label-width="200px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" :rules="editFormRules">
        <table cellspacing="0" cellpadding="0" class="mytable">
          <tr>
            <th colspan="2" style="width:120px; vertical-align: middle;">单位名称</th>
            <td colspan="2" style="vertical-align: middle;">
              {{unitName}}
              <!-- <el-form-item prop="unitName">
                <el-input v-model="editForm.unitName" style="width:500px"></el-input>
              </el-form-item> -->
            </td>
            <th style="width:120px; vertical-align: middle;">单位类型</th>
            <td style="vertical-align: middle;" colspan="3">
              <el-form-item prop="tableType" v-if="editFlag">
                <el-select v-model="editForm.tableType" @change="changeType">
                  <el-option :value="1" label="科研院所" />
                  <el-option :value="2" label="派出机构" />
                  <el-option :value="3" label="其他直属事业单位" />
                </el-select>
              </el-form-item>
              <span v-else>
                <span v-if="editForm.tableType===1">科研院所</span>
                <span v-else-if="editForm.tableType===2">派出机构</span>
                <span v-else-if="editForm.tableType===3">其他直属事业单位</span>
              </span>
            </td>
            <th style="width:120px; vertical-align: middle;">批复时间</th>
            <td style="vertical-align: middle;" colspan="3">
              <el-form-item prop="docDate" v-if="editFlag">
                <el-date-picker
                  v-model="editForm.docDate"
                  value-format="yyyy-MM-dd"
                  type="date"
                  placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
              <span v-else>{{editForm.docDate}}</span>
            </td>
            <th style="width:120px; vertical-align: middle;">批复文号</th>
            <td style="vertical-align: middle;" colspan="3">
              <el-form-item prop="docNum" v-if="editFlag">
                <el-input v-model="editForm.docNum" style="width:200px"></el-input>
              </el-form-item>
              <span v-else>{{editForm.docNum}}</span>
            </td>
          </tr>
          <tr>
            <th colspan="2" style="width:120px; vertical-align: middle;">PDF附件</th>
            <td colspan="14" style="vertical-align: middle;">
              <div v-if="editFlag">
                <el-upload
                  style="width:800px;margin-bottom:10px;"
                  ref="upload1"
                  :action="this.$http.defaults.baseURL+this.$http.defaults.postAPI +'api/cadrePostGenFileInfo/upload'"
                  :on-success="handleUploadSucc"
                  :on-remove="handleRemove"
                  :before-remove="beforeRemove"
                  :on-error="uploadError"
                  :before-upload="beforeUpload"
                  accept="application/pdf"
                  :limit="1"
                  :on-exceed="handleExceed"
                  :file-list="fileList"
                >
                  <el-button type="primary" :loading="saveloading">上传</el-button>
                  <div slot="tip" class="el-upload__tip">注：只支持上传pdf文件</div>
                </el-upload>
              </div>
              <div v-else>
                <template v-if="editForm.files&&editForm.files.length>0">
                  <div v-for="item in editForm.files" :key="'detailfile_'+item.id" style="height:40px;line-height:40px">
                    <a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{item.fileName}}.{{item.fileType}}</a>
                    <!-- <el-button v-if="canEdit" style="margin-left:10px" size="mini" type="danger" @click="beforeRemove(item)">删除</el-button> -->
                    <!-- <template v-if="item.fileType==='pdf'"><i style="cursor: pointer;" class="el-icon-search" @click="showfile(item.id)" /></template> -->
                  </div>
                </template>
              </div>
            </td>
          </tr>
          <tr>
            <th style="vertical-align: middle; text-align:center" colspan="2">岗位总量</th>
            <th style="vertical-align: middle; text-align:center">类别</th>
            <th style="vertical-align: middle; text-align:center" colspan="6">管理岗位</th>
            <th style="vertical-align: middle; text-align:center" colspan="3">专业技术岗位</th>
            <th style="vertical-align: middle; text-align:center" colspan="3">工勤技能岗位</th>
          </tr>
          <tr>
            <td style="vertical-align: middle; text-align:center" colspan="2">
              {{ editForm.managePost3+editForm.managePost4+editForm.managePost5+editForm.managePost6+editForm.managePost7+editForm.managePost8+editForm.managePost9+editForm.managePost10+editForm.techPost1+editForm.techPost2+editForm.techPost3+editForm.techPost4+editForm.techPost5+editForm.techPost6+editForm.techPost7+editForm.techPost8+editForm.techPost9+editForm.techPost10+editForm.techPost11+editForm.techPost12+editForm.techPost13+editForm.workPost1+editForm.workPost1+editForm.workPost2+editForm.workPost3+editForm.workPost5+editForm.workPost0 }}
            </td>
            <th style="vertical-align: middle; text-align:center">数量</th>
            <td style="vertical-align: middle; text-align:center" colspan="6">
              {{ editForm.managePost3+editForm.managePost4+editForm.managePost5+editForm.managePost6+editForm.managePost7+editForm.managePost8+editForm.managePost9+editForm.managePost10 }}
            </td>
            <td style="vertical-align: middle; text-align:center" colspan="3">
              {{ editForm.techPost1+editForm.techPost2+editForm.techPost3+editForm.techPost4+editForm.techPost5+editForm.techPost6+editForm.techPost7+editForm.techPost8+editForm.techPost9+editForm.techPost10+editForm.techPost11+editForm.techPost12+editForm.techPost13 }}
            </td>
            <td style="vertical-align: middle; text-align:center" colspan="3">
              {{ editForm.workPost1+editForm.workPost1+editForm.workPost2+editForm.workPost3+editForm.workPost5+editForm.workPost0 }}
            </td>
          </tr>
          <tr>
            <th rowspan="2" style="vertical-align: middle; text-align:center">管理岗位</th>
            <th style="vertical-align: middle; text-align:center">等级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">三级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">四级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">五级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">六级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">七级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">八级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">九级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">十级</th>
          </tr>
          <tr>
            <th style="vertical-align: middle; text-align:center">数量</th>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="managePost3" v-if="editFlag">
                <el-input-number v-model="editForm.managePost3" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.managePost3}}</span>
            </td>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="managePost4" v-if="editFlag">
                <el-input-number v-model="editForm.managePost4" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.managePost4}}</span>
            </td>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="managePost5" v-if="editFlag">
                <el-input-number v-model="editForm.managePost5" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.managePost5}}</span>
            </td>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="managePost6" v-if="editFlag">
                <el-input-number v-model="editForm.managePost6" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.managePost6}}</span>
            </td>
            <td colspan="1" style="vertical-align: middle; text-align:center">
              <el-form-item prop="managePost7" v-if="editFlag">
                <el-input-number v-model="editForm.managePost7" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.managePost7}}</span>
            </td>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="managePost8" v-if="editFlag">
                <el-input-number v-model="editForm.managePost8" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.managePost8}}</span>
            </td>
            <td colspan="1" style="vertical-align: middle; text-align:center">
              <el-form-item prop="managePost9" v-if="editFlag">
                <el-input-number v-model="editForm.managePost9" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.managePost9}}</span>
            </td>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="managePost10" v-if="editFlag">
                <el-input-number v-model="editForm.managePost10" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.managePost10}}</span>
            </td>
          </tr>
          <tr>
            <th style="vertical-align: middle; text-align:center" rowspan="5">专业技术岗位</th>
            <th style="vertical-align: middle; text-align:center">层级</th>
            <th style="vertical-align: middle; text-align:center" colspan="7">高级</th>
            <th style="vertical-align: middle; text-align:center" colspan="3">中级</th>
            <th style="vertical-align: middle; text-align:center" colspan="3">初级</th>
          </tr>
          <tr>
            <th style="vertical-align: middle; text-align:center">等级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">一级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">二级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">三级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">四级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">五级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">六级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">七级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">八级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">九级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">十级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">十一级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">十二级</th>
            <th style="vertical-align: middle; text-align:center" colspan="1">十三级</th>
          </tr>
          <tr>
            <th style="vertical-align: middle; text-align:center">基础指标岗位数量</th>
            <td colspan="1" style="vertical-align: middle; text-align:center">
              <el-form-item prop="techPost1" v-if="editFlag">
                <el-input-number v-model="editForm.techPost1" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.techPost1}}</span>
            </td>
            <td colspan="1" style="vertical-align: middle; text-align:center">
              <el-form-item prop="techPost2" v-if="editFlag">
                <el-input-number v-model="editForm.techPost2" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.techPost2}}</span>
            </td>
            <td colspan="1" style="vertical-align: middle; text-align:center">
              <el-form-item prop="techPost3" v-if="editFlag">
                <el-input-number v-model="editForm.techPost3" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.techPost3}}</span>
            </td>
            <td colspan="1" style="vertical-align: middle; text-align:center">
              <el-form-item prop="techPost4" v-if="editFlag">
                <el-input-number v-model="editForm.techPost4" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.techPost4}}</span>
            </td>
            <td colspan="1" style="vertical-align: middle; text-align:center">
              <el-form-item prop="techPost5" v-if="editFlag">
                <el-input-number v-model="editForm.techPost5" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.techPost5}}</span>
            </td>
            <td colspan="1" style="vertical-align: middle; text-align:center">
              <el-form-item prop="techPost6" v-if="editFlag">
                <el-input-number v-model="editForm.techPost6" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.techPost6}}</span>
            </td>
            <td colspan="1" style="vertical-align: middle; text-align:center">
              <el-form-item prop="techPost7" v-if="editFlag">
                <el-input-number v-model="editForm.techPost7" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.techPost7}}</span>
            </td>
            <td colspan="3" style="vertical-align: middle; text-align:center" v-if="editForm.tableType===1">
              <el-form-item prop="techPost8" v-if="editFlag">
                <el-input-number v-model="editForm.techPost8" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.techPost8}}</span>
            </td>
            <template v-else>
              <td colspan="1" style="vertical-align: middle; text-align:center">
                <el-form-item prop="techPost8" v-if="editFlag">
                  <el-input-number v-model="editForm.techPost8" style="width:90px" :min="0" controls-position="right" />
                </el-form-item>
                <span v-else>{{editForm.techPost8}}</span>
              </td>
              <td colspan="1" style="vertical-align: middle; text-align:center">
                <el-form-item prop="techPost9" v-if="editFlag">
                  <el-input-number v-model="editForm.techPost9" style="width:90px" :min="0" controls-position="right" />
                </el-form-item>
                <span v-else>{{editForm.techPost9}}</span>
              </td>
              <td colspan="1" style="vertical-align: middle; text-align:center">
                <el-form-item prop="techPost10" v-if="editFlag">
                  <el-input-number v-model="editForm.techPost10" style="width:90px" :min="0" controls-position="right" />
                </el-form-item>
                <span v-else>{{editForm.techPost10}}</span>
              </td>
            </template>
            <td colspan="3" style="vertical-align: middle; text-align:center" v-if="editForm.tableType===3">
              <el-form-item prop="techPost11" v-if="editFlag">
                <el-input-number v-model="editForm.techPost11" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.techPost11}}</span>
            </td>
            <template v-else>
              <td colspan="1" style="vertical-align: middle; text-align:center">
                <el-form-item prop="techPost11" v-if="editFlag">
                  <el-input-number v-model="editForm.techPost11" style="width:90px" :min="0" controls-position="right" />
                </el-form-item>
                <span v-else>{{editForm.techPost11}}</span>
              </td>
              <td colspan="1" style="vertical-align: middle; text-align:center">
                <el-form-item prop="techPost12" v-if="editFlag">
                  <el-input-number v-model="editForm.techPost12" style="width:90px" :min="0" controls-position="right" />
                </el-form-item>
                <span v-else>{{editForm.techPost12}}</span>
              </td>
              <td colspan="1" style="vertical-align: middle; text-align:center">
                <el-form-item prop="techPost13" v-if="editFlag">
                  <el-input-number v-model="editForm.techPost13" style="width:90px" :min="0" controls-position="right" />
                </el-form-item>
                <span v-else>{{editForm.techPost13}}</span>
              </td>
            </template>
          </tr>
          <tr v-if="editForm.tableType===1">
            <th style="vertical-align: middle; text-align:center">科技人才奖励指标岗位数量</th>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="3"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
          </tr>
          <tr v-else-if="editForm.tableType===3">
            <th style="vertical-align: middle; text-align:center">科技人才奖励指标岗位数量</th>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="3"></td>
          </tr>
          <tr v-else>
            <th style="vertical-align: middle; text-align:center">科技人才奖励指标岗位数量</th>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
          </tr>
          <tr v-if="editForm.tableType===1">
            <th style="vertical-align: middle; text-align:center">科技成果奖励指标岗位数量</th>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="3"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
          </tr>
          <tr v-else-if="editForm.tableType===3">
            <th style="vertical-align: middle; text-align:center">科技成果奖励指标岗位数量</th>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="3"></td>
          </tr>
          <tr v-else>
            <th style="vertical-align: middle; text-align:center">科技成果奖励指标岗位数量</th>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
            <td style="vertical-align: middle; text-align:center" colspan="1"></td>
          </tr>
          <tr>
            <th style="vertical-align: middle; text-align:center" rowspan="3">工勤技能岗位</th>
            <th style="vertical-align: middle; text-align:center" rowspan="2">等级</th>
            <th style="vertical-align: middle; text-align:center" colspan="10">技术工</th>
            <th style="vertical-align: middle; text-align:center" rowspan="2" colspan="3">普通工</th>
          </tr>
          <tr>
            <th style="vertical-align: middle; text-align:center" colspan="2">一级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">二级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">三级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">四级</th>
            <th style="vertical-align: middle; text-align:center" colspan="2">五级</th>
          </tr>
          <tr>
            <th style="vertical-align: middle; text-align:center">数量</th>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="workPost1" v-if="editFlag">
                <el-input-number v-model="editForm.workPost1" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.workPost1}}</span>
            </td>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="workPost2" v-if="editFlag">
                <el-input-number v-model="editForm.workPost2" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.workPost2}}</span>
            </td>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="workPost3" v-if="editFlag">
                <el-input-number v-model="editForm.workPost3" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.workPost3}}</span>
            </td>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="workPost4" v-if="editFlag">
                <el-input-number v-model="editForm.workPost4" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.workPost4}}</span>
            </td>
            <td colspan="2" style="vertical-align: middle; text-align:center">
              <el-form-item prop="workPost5" v-if="editFlag">
                <el-input-number v-model="editForm.workPost5" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.workPost5}}</span>
            </td>
            <td colspan="3" style="vertical-align: middle; text-align:center">
              <el-form-item prop="workPost0" v-if="editFlag">
                <el-input-number v-model="editForm.workPost0" style="width:90px" :min="0" controls-position="right" />
              </el-form-item>
              <span v-else>{{editForm.workPost0}}</span>
            </td>
          </tr>
        </table>
        <el-button type="primary" @click.native="editFormSubmit" :loading="editLoading" v-if="editFlag">提交</el-button>
      </el-form>
    </el-dialog>

    <!-- <el-table :data="list1" highlight-current-row v-loading="listLoading" style="width: 100%;margin-bottom: 20px;">
      <el-table-column prop="unitName" label="单位名称" min-width="250">
      </el-table-column>
      <el-table-column prop="unitType" label="单位类型">
      </el-table-column>
      <el-table-column prop="postNum1" width="120" label="管理岗位" align="center" />
      <el-table-column prop="postNum2" width="120" label="专业技术岗位" align="center" />
      <el-table-column prop="postNum3" width="120" label="工勤技能岗位" align="center" />
      <el-table-column label="操作" width="120" v-if="canEdit">
        <template slot-scope="scope">
          <template>
            <el-dropdown split-button  @click="handleDetail(scope.row.id)" size="small" type="primary" :loading="btnLoading">
              修改
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item @click.native="handleDel(scope.row.id)" >删除</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="120" v-else key="detail">
        <template slot-scope="scope">
          <template>
            <el-button @click="addFormVisible2=true" size="small" type="primary">查看</el-button>
          </template>
        </template>
      </el-table-column>
    </el-table> -->
    <el-dialog title="对比" :visible.sync="addFormVisible2" width="98%" top="20px">
      <table cellspacing="0" cellpadding="0" class="mytable">
        <tr>
          <th colspan="2" style="text-align:center">批复时间</th>
          <td v-for="(item,index) in multipleSelection" :key="'docDate'+index" style="text-align:center">{{item.docDate}}</td>
        </tr>
        <tr>
          <th colspan="2" style="text-align:center">批复文号</th>
          <td v-for="(item,index) in multipleSelection" :key="'docNum'+index" style="text-align:center">{{item.docNum}}</td>
        </tr>
        <tr>
          <th colspan="2" style="text-align:center">PDF附件</th>
          <td v-for="(item,index) in multipleSelection" :key="'dbfiles'+index" style="text-align:center">
            <div v-for="it in item.files" :key="'dbfile'+it.id"><a href="javascript:void(0)" @click="download(it.id)"><i class="el-icon-paperclip" /> {{it.fileName}}.{{it.fileType}}</a></div>
          </td>
        </tr>
        <tr>
          <th colspan="2" style="text-align:center">状态</th>
          <td v-for="(item,index) in multipleSelection" :key="'state'+index" style="text-align:center">{{item.state?'已下达':'未下达'}}</td>
        </tr>
        <tr>
          <th style="text-align:center;vertical-align: middle;" rowspan="13">专业技术岗位基础指标岗位数量</th>
          <th style="text-align:center">一级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost1'+index" style="text-align:center">{{item.techPost1}}</td>
        </tr>
        <tr>
          <th style="text-align:center">二级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost2'+index" style="text-align:center">{{item.techPost2}}</td>
        </tr>
        <tr>
          <th style="text-align:center">三级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost3'+index" style="text-align:center">{{item.techPost3}}</td>
        </tr>
        <tr>
          <th style="text-align:center">四级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost4'+index" style="text-align:center">{{item.techPost4}}</td>
        </tr>
        <tr>
          <th style="text-align:center">五级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost5'+index" style="text-align:center">{{item.techPost5}}</td>
        </tr>
        <tr>
          <th style="text-align:center">六级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost6'+index" style="text-align:center">{{item.techPost6}}</td>
        </tr>
        <tr>
          <th style="text-align:center">七级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost7'+index" style="text-align:center">{{item.techPost7}}</td>
        </tr>
        <tr>
          <th style="text-align:center">八级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost8'+index" style="text-align:center">{{item.techPost8}}</td>
        </tr>
        <tr>
          <th style="text-align:center">九级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost9'+index" style="text-align:center">{{item.techPost9}}</td>
        </tr>
        <tr>
          <th style="text-align:center">十级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost10'+index" style="text-align:center">{{item.techPost10}}</td>
        </tr>
        <tr>
          <th style="text-align:center">十一级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost11'+index" style="text-align:center">{{item.techPost11}}</td>
        </tr>
        <tr>
          <th style="text-align:center">十二级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost12'+index" style="text-align:center">{{item.techPost12}}</td>
        </tr>
        <tr>
          <th style="text-align:center">十三级</th>
          <td v-for="(item,index) in multipleSelection" :key="'techPost13'+index" style="text-align:center">{{item.techPost13}}</td>
        </tr>
      </table>
    </el-dialog>
    <el-radio-group v-model="status" >
      <el-radio-button :label="1">事业单位岗位设置方案表</el-radio-button>
      <el-radio-button :label="2">科技人才奖励指标岗位表</el-radio-button>
      <el-radio-button :label="3">科技成果奖励指标岗位表</el-radio-button>
    </el-radio-group>
    <div v-show="status===1">
      <div v-if="canEdit" style="height: 50px;">
        <el-button icon="el-icon-document-copy" type="primary" style="float:right;margin-left:10px" @click="duibi()">对比</el-button>
        <el-button icon="el-icon-plus" type="success" style="float:right" @click="handleAdd()">新增</el-button>
      </div>
      <el-table :data="list1" highlight-current-row v-loading="listLoading" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange">
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column prop="docDate" label="批复时间" width="150" align="center">
        </el-table-column>
        <el-table-column prop="docNum" label="批复文号" width="250" align="center">
        </el-table-column>
        <el-table-column prop="pdf" min-width="320" label="PDF附件">
          <template slot-scope="scope">
            <div v-for="item in scope.row.files" :key="'file_'+item.id"><a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{ item.fileName }}.{{ item.fileType }}</a></div>
          </template>
        </el-table-column>
        <el-table-column prop="state" width="120" label="状态" align="center">
          <template slot-scope="scope">
            {{scope.row.state?'已下达':'未下达'}}
          </template>
        </el-table-column>
        <el-table-column label="操作" width="220" v-if="canEdit">
          <template slot-scope="scope">
            <template>
              <el-button v-if="!scope.row.state" @click="setState(scope.row.id,1)" size="small" type="success" :loading="btnLoading">
                下达
              </el-button>
              <el-button v-else @click="setState(scope.row.id,0)" size="small" type="danger" :loading="btnLoading">
                撤回
              </el-button>
              <el-dropdown split-button v-if="!scope.row.state" @click="handleDetail(scope.row,0)" size="small" type="primary" :loading="btnLoading">
                查看
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item @click.native="handleDetail(scope.row,1)" >修改</el-dropdown-item>
                  <el-dropdown-item @click.native="handleDel(scope.row.id)" >删除</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
              <el-button v-else @click="handleDetail(scope.row,0)" size="small" type="primary">
                查看
              </el-button>
            </template>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="120" v-else key="detail">
          <template slot-scope="scope">
            <template>
              <el-button @click="handleDetail(scope.row,0)" size="small" type="primary">查看</el-button>
            </template>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div v-show="status===2">
        <el-button icon="el-icon-plus" type="success" style="float:right" @click="addFormVisible1=true">新增</el-button>
        <el-form :model="editForm" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" inline-message>
          <el-form-item prop="title">
            <el-checkbox v-model="editForm.title">只显示当前在岗人员</el-checkbox>
            <!-- <el-input v-model="editForm.title" style="width:100px"></el-input> -->
          </el-form-item>
          <!-- <el-form-item prop="title" label="身份证号">
            <el-input v-model="editForm.title" style="width:200px"></el-input>
          </el-form-item>
          <el-form-item prop="title" label="本聘期起止时间">
            <el-date-picker
              v-model="startYear"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item prop="title" label="岗位等级">
            <el-select v-model="editForm.unitTyep">
              <el-option :value="1" label="一级" />
              <el-option :value="2" label="二级" />
              <el-option :value="3" label="三级" />
            </el-select>
          </el-form-item>
          <el-form-item >
            <el-button type="success" @click.native="addFormSubmit" :loading="addLoading">保存</el-button>
          </el-form-item> -->
        </el-form>
        <el-table :data="list2" highlight-current-row v-loading="listLoading" style="width: 100%;margin-bottom: 20px;" >
          <el-table-column prop="sendTime" label="批复时间" width="150" align="center">
          </el-table-column>
          <el-table-column prop="docNum" label="批复文号" width="250" align="center">
          </el-table-column>
          <el-table-column prop="pdf" min-width="320" label="PDF附件">
            <template slot-scope="scope">
              <div><a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{ scope.row.pdf }}</a></div>
            </template>
          </el-table-column>
          <el-table-column prop="num1" width="120" label="数量" align="center">
          </el-table-column>
          <el-table-column prop="num2" width="120" label="使用数量" align="center" />
          <el-table-column label="详情" min-width="120">
            <template slot-scope="scope">
              <span style="color:green">张三</span>、
              <span style="color:red">李四(不在岗)</span>、
              <span style="color:red">王五(调出)</span>
            </template>
          </el-table-column>
          <!-- <el-table-column label="操作" width="120" v-if="canEdit">
            <template slot-scope="scope">
              <template>
                <el-dropdown split-button  @click="handleDetail(scope.row.id)" size="small" type="primary" :loading="btnLoading">
                  修改
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item @click.native="handleDel(scope.row.id)" >删除</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </template>
          </el-table-column> -->
        <el-table-column prop="status" width="120" label="状态" align="center" />
        <el-table-column label="操作" width="120" v-if="canEdit">
          <template slot-scope="scope">
            <template>
              <el-dropdown split-button v-if="scope.row.status=='未下达'" @click="handleDetail(scope.row.id)" size="small" type="primary" :loading="btnLoading">
                下达
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item @click.native="handleDel(scope.row.id)" >修改</el-dropdown-item>
                  <el-dropdown-item @click.native="handleDel(scope.row.id)" >删除</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
              <el-button v-else @click="handleDetail(scope.row.id)" size="small" type="danger" :loading="btnLoading">
                撤回
              </el-button>
            </template>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="120" v-else key="detail">
          <template slot-scope="scope">
            <template>
              <el-button @click="addFormVisible2=true" size="small" type="primary">查看</el-button>
            </template>
          </template>
        </el-table-column>
        </el-table>
    </div>
    <div v-show="status===3">
        <el-form :model="editForm" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" inline-message>
          <!-- <el-button type="primary" @click.native="addFormSubmit" :loading="addLoading" style="float:right">新增</el-button> -->
          <!-- <el-form-item prop="title" label="开始时间">
            <el-date-picker
              v-model="startYear"
              type="date">
            </el-date-picker>
          </el-form-item>
          <el-form-item prop="title" label="数量">
            <el-input-number v-model="editForm.title" style="width:90px" :min="0" controls-position="right" />
          </el-form-item>
          <el-form-item prop="title" label="岗位等级">
            <el-select v-model="editForm.unitTyep">
              <el-option :value="1" label="一级" />
              <el-option :value="2" label="二级" />
              <el-option :value="3" label="三级" />
            </el-select>
          </el-form-item>
          <el-form-item >
            <el-button type="success" @click.native="addFormSubmit" :loading="addLoading">保存</el-button>
          </el-form-item> -->
        </el-form>
      <div v-if="canEdit" style="height: 50px;">
        <span style="color:red;font-weight: bolder;line-height: 50px;">科技成果岗位指标已超过5年</span>
        <el-button icon="el-icon-plus" type="success" style="float:right" @click="addFormVisible1=true">新增</el-button>
      </div>
      <el-table :data="list3" highlight-current-row v-loading="listLoading" style="width: 100%;margin-bottom: 20px;">
        <el-table-column prop="sendTime" label="批复时间" width="150" align="center">
        </el-table-column>
        <el-table-column prop="docNum" label="批复文号" width="250" align="center">
        </el-table-column>
        <el-table-column prop="pdf" min-width="320" label="PDF附件">
          <template slot-scope="scope">
            <div><a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{ scope.row.pdf }}</a></div>
          </template>
        </el-table-column>
        <el-table-column label="数量" align="center">
          <el-table-column prop="num" label="合计" align="center" width="100" />
          <el-table-column prop="num2" label="二级" align="center" width="100" />
          <el-table-column prop="num3" label="三级" align="center" width="100" />
          <el-table-column prop="num4" label="四级" align="center" width="100" />
          <el-table-column prop="num5" label="五级" align="center" width="100" />
          <el-table-column prop="num6" label="六级" align="center" width="100" />
          <el-table-column prop="num7" label="七级" align="center" width="100" />
        </el-table-column>
        <!-- <el-table-column prop="level" width="120" label="岗位等级" align="center" />
        <el-table-column label="操作" width="120" v-if="canEdit">
          <template slot-scope="scope">
            <template>
              <el-dropdown split-button  @click="handleDetail(scope.row.id)" size="small" type="primary" :loading="btnLoading">
                修改
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item @click.native="handleDel(scope.row.id)" >删除</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </template>
          </template>
        </el-table-column> -->
        <el-table-column prop="status" width="120" label="状态" align="center" />
        <el-table-column label="操作" width="120" v-if="canEdit">
          <template slot-scope="scope">
            <template>
              <el-dropdown split-button v-if="scope.row.status=='未下达'" @click="handleDetail(scope.row.id)" size="small" type="primary" :loading="btnLoading">
                下达
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item @click.native="handleDel(scope.row.id)" >修改</el-dropdown-item>
                  <el-dropdown-item @click.native="handleDel(scope.row.id)" >删除</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
              <el-button v-else @click="handleDetail(scope.row.id)" size="small" type="danger" :loading="btnLoading">
                撤回
              </el-button>
            </template>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="120" v-else key="detail">
          <template slot-scope="scope">
            <template>
              <el-button @click="addFormVisible2=true" size="small" type="primary">查看</el-button>
            </template>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- <div v-else style="padding:20px; font-size:14px;color:#999;text-align:center">暂无数据</div> -->
  </div>
</template>
<script>
const defaultForm = {
  id: null,
  state: 0,
  tableType: null,
  docDate: '',
  docNum: '',
  managePost3: 0,
  managePost4: 0,
  managePost5: 0,
  managePost6: 0,
  managePost7: 0,
  managePost8: 0,
  managePost9: 0,
  managePost10: 0,
  techPost1: 0,
  techPost2: 0,
  techPost3: 0,
  techPost4: 0,
  techPost5: 0,
  techPost6: 0,
  techPost7: 0,
  techPost8: 0,
  techPost9: 0,
  techPost10: 0,
  techPost11: 0,
  techPost12: 0,
  techPost13: 0,
  workPost1: 0,
  workPost2: 0,
  workPost3: 0,
  workPost4: 0,
  workPost5: 0,
  workPost0: 0,
  fileIds: []
}
export default {
  props: {
    timestamp: null,
    canEdit: null,
    unitId: null
  },
  data () {
    return {
      saveloading: false,
      multipleSelection: [],
      editFormRules: {
        tableType: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        docDate: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        docNum: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        managePost3: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        managePost4: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        managePost5: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        managePost6: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        managePost7: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        managePost8: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        managePost9: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        managePost10: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost1: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost2: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost3: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost4: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost5: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost6: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost7: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost8: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost9: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost10: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost11: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost12: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        techPost13: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        workPost1: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        workPost2: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        workPost3: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        workPost4: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        workPost5: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        workPost0: [
          { required: true, message: '必填', trigger: 'blur' }
        ]
      },
      editFlag: 0,
      listLoading: false,
      unitName: '',
      editLoading: false,
      editForm: Object.assign({}, defaultForm),
      editFormVisible: false,
      dialogTitle: '新增',
      status: 1,
      fileList: [],
      btnLoading: false,
      addFormVisible1: false,
      addFormVisible2: false,
      startYear: '2021',
      list1: [
        // {sendTime: '2023-09-01', docNum: '文号111', pdf: '单位1事业单位岗位设置方案表2.pdf', status: 1},
        // {sendTime: '2023-08-01', docNum: '文号222', pdf: '单位1事业单位岗位设置方案表1.pdf', status: 0}
      ],
      list2: [
        {sendTime: '2023-09-01', docNum: '文号111', pdf: '科技人才奖励指标岗位表1.pdf', num1: 2, num2: 1, status: '已下达'},
        {sendTime: '2023-08-01', docNum: '文号222', pdf: '科技人才奖励指标岗位表2.pdf', num1: 1, num2: 1, status: '已下达'}
      ],
      list3: [
        {sendTime: '2013-08-20', docNum: '文号111', pdf: '科技成果奖励指标岗位表1.pdf', num: 12, num2: 2, num3: 2, num4: 2, num5: 2, num6: 2, num7: 2, status: '已下达'},
        {sendTime: '2012-01-01', docNum: '文号222', pdf: '科技成果奖励指标岗位表2.pdf', num: 11, num2: 1, num3: 2, num4: 2, num5: 2, num6: 2, num7: 2, status: '已下达'}
      ],
      topersonlist: [],
      activeNameHuiqian: 'Fangan',
      huiqiandata: {
        Fangan: {},
        HS_HuiYiYiCheng: {}
      },
      Fangansrc: '',
      showPDFVisible: false,
      YijianDuixiang: '全部（总结提炼）',
      BanziPersonName: '全部',
      pdfviewersrc: '',
      TanhuaDuixiang: '全部',
      pdfpage: 1,
      FujianFilename: '',
      pdfviewersrcFujian: '',
      showPDFVisibleFujian: false
    }
  },
  watch: {
    timestamp: {
      handler (val) {
        this.loaddata()
      },
      immediate: true
    },
    unitId: {
      handler (val) {
        this.loaddata()
      },
      immediate: true
    },
    canEdit: {
      handler (val) {
        console.log(val)
      },
      immediate: true
    }
  },
  methods: {
    beforeUpload (file) {
      const isFormat = file.name.indexOf('.pdf') > 0 || file.name.indexOf('.PDF') > 0
      const isLt500M = file.size / 1024 / 1024 < 60
      if (!isLt500M) {
        this.$message.error('单个附件不能超过60M!')
      } else {
        this.saveloading = true
      }
      if (!isFormat) {
        this.$message.error('附件格式必须为pdf!')
      } else {
        this.saveloading = true
      }
      return isFormat && isLt500M
    },
    async handleUploadSucc (response, file, fileList) {
      this.saveloading = false
      if (response.success) {
        let obj = response.result[0]
        this.fileList.push({id: obj.id, name: obj.fileName + '.' + obj.fileType, url: this.$http.defaults.baseURL + this.$http.defaults.postAPI + 'api/cadrePostGenFileInfo/download?id=' + obj.id})
        this.$message({
          message: '上传成功！',
          type: 'success'
        })
      } else {
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    beforeRemove (file) {
      if (file && file.status === 'success') {
        return this.$confirm(`确定删除 ${file.name}？`)
      }
    },
    handleRemove (file, fileList) {
      console.log('file')
      console.log(file)
      if (file && file.status === 'success') {
        let fileid = file.id ? file.id : file.response.result[0].id
        this.fileList = this.fileList.filter(item => item.id !== fileid)
        this.$message({
          message: '删除成功！',
          type: 'success'
        })
      }
    },
    uploadError (err) {
      this.saveloading = false
      console.log(err)
      this.$message({
        message: '上传失败:' + err,
        type: 'error'
      })
    },
    download (id) {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.postAPI + 'api/cadrePostGenFileInfo/download?id=' + id)
    },
    handleSelectionChange (val) {
      this.multipleSelection = val
    },
    duibi () {
      if (this.multipleSelection.length > 1) {
        this.addFormVisible2 = true
      } else {
        this.$message({
          message: '至少选择两条记录',
          type: 'error'
        })
      }
    },
    changeType () {
      if (this.editForm.tableType === 1) {
        this.editForm.techPost9 = 0
        this.editForm.techPost10 = 0
      } else if (this.editForm.tableType === 3) {
        this.editForm.techPost12 = 0
        this.editForm.techPost13 = 0
      }
    },
    setState (id, state) {
      this.$confirm('确认' + (state === 1 ? '下达' : '撤回') + '吗?', '提示', {
        type: 'warning'
      }).then(() => {
        let tableName = 'cadrePostBusPostPlan'
        let para = {
          id: id,
          state: state === 1 ? 1 : 0
        }
        this.btnLoading = true
        this.$http.post(this.$http.defaults.postAPI + 'api/' + tableName + '/save', para).then(response => {
          this.btnLoading = false
          if (response.data.success === true) {
            this.$message({
              message: '操作成功',
              type: 'success'
            })
            this.getList()
          } else {
            console.log('操作失败:' + response.data.message)
            this.$message({
              message: '操作失败:' + response.data.message,
              type: 'error'
            })
          }
        }).catch(error => {
          this.btnLoading = false
          console.log(error)
          this.$message({
            message: '操作失败:' + error,
            type: 'error'
          })
        })
      })
    },
    handleDel (id) {
      this.$confirm('确认删除该记录吗?', '提示', {
        type: 'warning'
      }).then(() => {
        let tableName = 'cadrePostBusPostPlan'
        let para = {ids: [id]}
        this.listLoading = true
        this.$http.post(this.$http.defaults.postAPI + 'api/' + tableName + '/remove', para).then(response => {
          if (response.data.success === true) {
            this.addLoading = false
            this.$message({
              message: '删除成功',
              type: 'success'
            })
          } else {
            console.log('删除失败:' + response.data.message)
            this.$message({
              message: '删除失败:' + response.data.message,
              type: 'error'
            })
          }
          this.getList()
        })
          .catch(error => {
            this.addLoading = false
            console.log(error)
            this.$message({
              message: '删除失败:' + error,
              type: 'error'
            })
          })
      })
    },
    getList () {
      if (this.unitId) {
        let tableName = 'cadrePostBusPostPlan'
        this.listLoading = true
        let para = {
          pageNum: 1,
          pageSize: 1000,
          unitId: this.unitId
        }
        this.$http.post(this.$http.defaults.postAPI + 'api/' + tableName + '/queryByPage', para).then(response => {
          this.listLoading = false
          if (response.data.success === true) {
            this.list1 = response.data.result.records
          } else {
            console.log('获取数据失败:' + response.data.message)
            this.$message({
              message: '获取数据失败:' + response.data.message,
              type: 'error'
            })
          }
        }).catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
          this.listLoading = false
        })
      }
    },
    getUnitDetails () {
      if (this.unitId) {
        this.$http
          .get(this.$http.defaults.postAPI + `api/cadrePostBusUnit/getById?id=` + this.unitId)
          .then(response => {
            if (response.data.success === true) {
              console.log('获取成功')
              this.unitName = response.data.result.unitName
            } else {
              console.log('获取失败:' + response.data.message)
              this.$message({
                message: '获取失败:' + response.data.message,
                type: 'error'
              })
            }
          })
          .catch(error => {
            this.$message({
              message: '获取失败:' + error,
              type: 'error'
            })
          })
      }
    },
    editFormSubmit () {
      this.$refs.editForm.validate((valid) => {
        if (valid) {
          this.editLoading = true
          let para = Object.assign({}, this.editForm)
          para.unitId = this.unitId
          para.fileIds = this.fileList.map(item => item.id)
          console.log(para)
          let tableName = 'cadrePostBusPostPlan'
          this.$http.post(this.$http.defaults.postAPI + 'api/' + tableName + '/save', para).then(response => {
            console.log(response.data.success)
            if (response.data.success === true) {
              this.$message({
                message: '提交成功',
                type: 'success'
              })
              this.editFormVisible = false
              this.editLoading = false
              this.getList()
            } else {
              console.log('提交失败:' + response.data.message)
              this.$message({
                message: '提交失败:' + response.data.message,
                type: 'error'
              })
              this.editLoading = false
            }
          }).catch(error => {
            console.log(error)
            this.$message({
              message: '提交失败:' + error,
              type: 'error'
            })
            this.editLoading = false
          })
        }
      })
    },
    handleAdd () {
      this.dialogTitle = '新增'
      this.editForm = Object.assign({}, defaultForm)
      this.fileList = []
      this.editFormVisible = true
      this.editFlag = 1
    },
    handleDetail (obj, editFlag) {
      this.dialogTitle = '修改'
      this.editForm = Object.assign({}, obj)
      this.fileList = []
      this.editForm.files.forEach(item => {
        this.fileList.push({id: item.id, name: item.fileName + '.' + item.fileType, url: this.$http.defaults.baseURL + this.$http.defaults.postAPI + 'api/cadrePostGenFileInfo/download?id=' + item.id})
      })
      this.editFormVisible = true
      this.editFlag = editFlag
    },
    handlePreview (file) {
      console.log(file)
    },
    handleExceed (files, fileList) {
      this.$message.warning(`最多上传1个文件`)
    },
    MyGetDateStr (date) { // author: meizz\
      let fmt = 'yyyy-MM-dd'
      if (date) {
        // date = date.replace(new RegExp(/-/gm), '/')
        let mydate = new Date(date)
        var o = {
          'M+': mydate.getMonth() + 1, // 月份
          'd+': mydate.getDate(), // 日
          'h+': mydate.getHours(), // 小时
          'm+': mydate.getMinutes(), // 分
          's+': mydate.getSeconds(), // 秒
          'q+': Math.floor((mydate.getMonth() + 3) / 3), // 季度
          'S': mydate.getMilliseconds() // 毫秒
        }
        if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (mydate.getFullYear() + '').substr(4 - RegExp.$1.length)) }
        for (var k in o) {
          if (new RegExp('(' + k + ')').test(fmt)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) }
        }
        return fmt
      } else {
        return null
      }
    },
    changetopersonlist () {
      this.TanhuaDuixiang = '全部'
      let _this = this
      if (this.BanziPersonName === '全部') {
        this.topersonlist = _this.huiqiandata.HQ_TanHua_ToPerson
        console.log('this.topersonlist')
        console.log(this.topersonlist.length)
      } else {
        this.topersonlist = []
        this.huiqiandata.HQ_TanHua.forEach(function (item) {
          if (item.BanziPersonName === _this.BanziPersonName) {
            _this.topersonlist.push({Name: item.Duixiang})
          }
        })
      }
    },
    tabClick () {
      var params = {Link_hq: this.activeNameHuiqian}
      this.$store.commit('tablink_hq', params)
    },
    pinggushow () {
      var params1 = {Link1: 'Pingjia'}
      this.$store.commit('tablink1', params1)
    },
    // showfile (filename, filepathname) {
    //   window.open(this.$http.defaults.baseURL + 'shenghuohui/getfujian/' + this.$route.params.id + '?filepathname=' + filepathname + '&t=' + new Date())
    // },
    showfile (filename, filepathname) {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.shenghuohuiAPI + 'api/shenghuohui/getfujian?unitId=' + this.$route.params.id + '&filepathname=' + filepathname + '&t=' + new Date())
    },
    pdfshow () {
      window.open(this.basesrc + new Date())
    },
    dateFormat: function (row, column) {
      var date = row[column.property]
      if (date === undefined) {
        return ''
      }
      return this.MyGetDateStr(date)
    },
    loaddata () {
      this.getUnitDetails()
      this.getList()
    }
  }
}
</script>
<style scoped>
  .mytable{
    border-top: 1px solid #74a6cc;
    border-left: 1px solid #74a6cc;
    margin:0 10px 10px;
    width: calc(100% - 20px);
  }
  .mytable th{
    padding: 10px;
    border-right: 1px solid #74a6cc;
    border-bottom: 1px solid #74a6cc;
    vertical-align: top;
    line-height: 150%;
    background: #FAFAFA;
    width:200px;
    text-align:right;
  }
  .mytable td{
    padding: 10px;
    border-right: 1px solid #74a6cc;
    border-bottom: 1px solid #74a6cc;
    vertical-align: top;
    line-height: 150%;
  }
</style>
<style>
#recruitTable .el-table{
  border:1px solid #95B8E7 !important;
}
#recruitTable .el-table td, #recruitTable .el-table th{
  border-right:1px solid #95B8E7 !important;
  border-bottom:1px solid #95B8E7 !important;
}
</style>
